useR! 2021 - 2021/07/06

Produce publication ready thematic maps

Standing on the Shoulders of Giants

deepdep image

Create a map

mf_map() is the main function of the package

mf_map(x = sf_object, 
       var = "variable", 
       type = "map type", 
       ...)

mf_map()

Map Types

Map Layout

mf_title()
mf_arrow()
mf_credits()
mf_scale()  
mf_layout() 
mf_annotation()     
mf_label()
mf_shadow()

https://riatelab.github.io/mapsf/

Vignettes

Alternative Solutions

ggplot2 (Wickham, 2016) + ggspatial (Dunnington, 2018)

  • A general purpose graphic library

tmap (Tennekes, 2018)

  • A mapping library with similar functionalities
  • Uses a different grammar (à la ggplot2)
  • Allows interactive maps

cartography (Giraud and Lambert, 2016)

  • mapsf predecessor
  • In maintenance mode

Examples

mtq <- mf_get_mtq()
# Start a map using a theme and extra margins 
mf_init(x = mtq, theme = "dark",
        expandBB = c(0,0,0,.3)) 
# Plot a shadow
mf_shadow(mtq, col = "grey10", add = TRUE)
# Plot a choropleth map
mf_map(x = mtq, var = "MED", type = "choro",
       pal = "Dark Mint", 
       breaks = "quantile", 
       nbreaks = 6, 
       leg_title = "Median Income\n(euros)", 
       leg_val_rnd = -2,
       add = TRUE)
# Add an inset world map
mf_inset_on(x = "worldmap", pos = "right")
mf_worldmap(mtq, col = "#0E3F5C")
mf_inset_off()
# Plot a layout elements
mf_title("Wealth in Martinique, 2015")
mf_credits("T. Giraud\nSources: INSEE & IGN, 2018")
mf_scale(size = 5)
mf_arrow('topleft')

Thank You